package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

/** enter page by Ticketing \Call Home Rules , create and save record*/
public class SpTicketCallHomeRulesPageUtil extends SeleniumPageUtil {
	
	public final static By TCHR_SELECT_RULES_GROUPS 			= By.id("ctl44_cboRuleGroups");
	public final static By TCHR_LINK_NEW_GROUPS 			= By.id("ctl44_btnNew");
	public final static By TCHR_SPAN_HEAD_TITLE 			= By.id("ctl44_lblHdr");
	
	// whether select any one of rules groups elements, the results page is the same 
	public final static By TCHR_OPTION_RULE_EMAIL_INBOUND = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table/tbody/tr/td/select/option[2]");
	// When select an option,a result div show
	public final static By TCHR_TH_NAME = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[1]");
	public final static By TCHR_TH_GROUP = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[2]");
	public final static By TCHR_TH_REGEX_SENDER = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[3]");
	public final static By TCHR_TH_REGEX_RECIPIENT = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[4]");
	public final static By TCHR_TH_REGEX_SUBJECT = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[5]");
	public final static By TCHR_TH_REGEX_MESSAGE = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[6]");
	public final static By TCHR_TH_REGEX_ATTACHMENTS = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[7]");
	public final static By TCHR_TH_ISACTIVE = By.xpath("//*[@id='ctl44_lblRules']/table/tbody/tr[1]/th[8]");
	
	// when click the new button a new window show
	public final static By TCHR_BUTTON_CLOSE = By.id("ctl44_btnDone");
	public final static By TCHR_SPAN_HEADER = By.id("ctl44_lblHdr" );
	public final static By TCHR_LBL_RULE_NAME = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[1]/td[1]");
	public final static By TCHR_INPUT_RULE_NAME = By.id("ctl44_txtRuleName");
	public final static By TCHR_LBL_RULE_GROUP = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[1]/td[3]");
	public final static By TCHR_SELECT_RULE_GROUP = By.id("ctl44_cboRuleGroup");
	public final static By TCHR_LBL_FROM = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[3]/td[1]");
	public final static By TCHR_INPUT_FROM = By.id("ctl44_txtFrom");
	public final static By TCHR_LBL_TO = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[3]/td[3]");
	public final static By TCHR_INPUT_TO = By.id("ctl44_txtTo");
	public final static By TCHR_LBL_SUBJECT = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[4]/td[1]");
	public final static By TCHR_INPUT_SUBJECT = By.id("ctl44_txtSubject");
	public final static By TCHR_LBL_MESSAGE_BODY = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[5]/td[1]");
	public final static By TCHR_INPUT_MESSAGE_BODY = By.id("ctl44_txtMsgBody");
	public final static By TCHR_LBL_ATTACHMENT = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[6]/td[1]");
	public final static By TCHR_INPUT_ATTACHMENT = By.id("ctl44_txtAttachment");
	public final static By TCHR_LBL_IS_ACTIVE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[2]/tbody/tr[7]/td[1]");
	public final static By TCHR_CHECKBOX_IS_ACTIVE = By.id("ctl44_chkIsActive");
	
	
	public static void enter(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterCallHomeRulesPage();
	}
	
	public static void waitForPageToLoad(){
		// call home rules page in content area
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				TCHR_LINK_NEW_GROUPS
			});
	}
}
